package com.example.demo.controller;


import com.diboot.core.service.DictionaryService;
import com.diboot.core.service.impl.DictionaryServiceImpl;
import com.diboot.core.vo.JsonResult;
import com.diboot.core.vo.Status;
import com.example.demo.entity.BusinessEntity;
import com.example.demo.service.IDsBusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 前端控制器
 *
 * @author dxd
 * @since 2020-09-03
 */
@RestController
@RequestMapping("/manage/business")
public class DsBusinessController {

    @Autowired
    IDsBusinessService service;

    @Bean("dictionaryService")
    public DictionaryService dictionaryService() {
        return new DictionaryServiceImpl();
    }

//    @Bean
//    @ConditionalOnMissingBean
//    public PaginationInterceptor paginationInterceptor() {
//        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
//        return paginationInterceptor;
//    }

    /**
     * Get User List
     *
     * @param
     */
//    @GetMapping("/list")
//    public JsonResult getViewObjectListMapping(BusinessEntity queryDto, Pagination pagination) throws Exception {
//    }
    @PostMapping("create")
    public JsonResult object(@RequestBody() BusinessEntity entity) {
        service.save(entity);
        return JsonResult.OK(Status.OK);
    }


    //    @Configuration
    //    @EnableTransactionManagement
    //    @ComponentScan(basePackages={"com.example"})
    //    @MapperScan(basePackages={"com.example.demo.mapper"})
    //    @SpringBootApplication
    //    public static class DemoApplication {
    //        public static void main(String[] args) {
    //            SpringApplication.run(com.example.demo.DemoApplication.class, args);
    //            IDsBusinessService service =  SpringContextHolder.getBean(IDsBusinessService.class);
    //            service.save(new DsBusiness());
    //
    //        }
    //
    //    }
}
